package com.small.common.util;


import java.util.HashMap;
import java.util.Map;

/**
 * 查询参数
 */
public class Query extends HashMap<String, Object> {
    private static final long serialVersionUID = 1L;
    //起始条数
    private int offset = 0;
    //每页条数
    private int limit = 10;

    public Query(Map<String, Object> params) {
        this.putAll(params);
        //分页参数
        if (params.get("offset") != null) {
            this.offset = Integer.parseInt(params.get("offset").toString());
        }
        if (params.get("limit") != null) {
            this.limit = Integer.parseInt(params.get("limit").toString());
        }
        this.remove("offset");
        this.remove("limit");
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }
}
